package sugar;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * 泛型擦除
 */
public class GenericErasure {

    public static void main(String[] args) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
        List<Integer> list = new ArrayList<>();
        list.add(123);
        Class<?> clz = list.getClass();
        Method method = clz.getMethod("add", Object.class);
        method.invoke(list, "qwe");
        method.invoke(list, "haha");
        System.out.println(list);

    }
}
